//////////////////////////////////////////////////////////////////
//
// City.cs
//
// Copyright (c) 2012 Dan Pike. All rights reserved
//
// Refer to license.txt for any license restrictions.
// 
using Utilities;
using System.Configuration;

namespace Entities.Archive
{
   public class City : Utilities.ArchiveElement
   {
      public City()
      {
         Properties.Add(name_);
         Properties.Add(population_);
         Properties.Add(factories_);
         factories = new Factories();
      }

      ////////////////////////////////////////////////////////////////////////
      //
      [ConfigurationProperty("name")]
      public string name
      {
         get { return Global.normalizeName((string)base[name_], Global.NormalizeType.City); }
         set { base[name_] = Global.normalizeName(value, Global.NormalizeType.City); }
      }

      [ConfigurationProperty("population")]
      public int population
      {
         get { return (int)base[population_]; }
         set { base[population_] = value; }
      }

      [ConfigurationProperty("factories")]
      public Factories factories
      {
         get { return (Factories)base[factories_]; }
         set { base[factories_] = value; }
      }

      ////////////////////////////////////////////////////////////////////////
      //
      private ConfigurationProperty name_ = new ConfigurationProperty("name", typeof(string), string.Empty);
      private ConfigurationProperty population_ = new ConfigurationProperty("population", typeof(int), 0);
      private ConfigurationProperty factories_ = new ConfigurationProperty("factories", typeof(Factories), null);
   }
}
